#include<iostream>
using namespace std;
#include<vector>
#include<unordered_map>


vector<int> twoSum(vector<int>& nums, int target) {
    unordered_map<int, int> hash;

    vector<int> nums2;
    for (int i = 0; i < nums.size(); i++)
    {
        hash[nums[i]] = i + 1;
    }

    for (int i = 0; i < nums.size(); i++)
    {
        if (target == 2 * nums[i])
        {
            for (int m = 0; m < i; m++)
            {
                if (nums[m] == nums[i])
                {
                    nums2.push_back(m);
                    nums2.push_back(i);
                    return nums2;
                }
            }
        }
        else if (hash[target - nums[i]] != 0)
        {
            nums2.push_back(i);
            nums2.push_back(hash[target - nums[i]] - 1);
            return nums2;
        }
    }
    return nums2;
}


int main()
{
    vector<int> nums = { 3,3 };
    twoSum(nums, 6);
	return 0;
}